package Mangos::DB::Characters::Auctionhouse;

use strict;
use warnings;

use base qw(Mangos::DB::Characters);

__PACKAGE__->meta->setup
(
    table   => 'auctionhouse',

    columns => 
    [
        id             => { type => 'integer', not_null => 1 },
        auctioneerguid => { type => 'integer', default => '0', not_null => 1 },
        itemguid       => { type => 'integer', default => '0', not_null => 1 },
        item_template  => { type => 'integer', default => '0', not_null => 1 },
        itemowner      => { type => 'integer', default => '0', not_null => 1 },
        buyoutprice    => { type => 'integer', default => '0', not_null => 1 },
        time           => { type => 'bigint', default => '0', not_null => 1 },
        buyguid        => { type => 'integer', default => '0', not_null => 1 },
        lastbid        => { type => 'integer', default => '0', not_null => 1 },
        startbid       => { type => 'integer', default => '0', not_null => 1 },
        deposit        => { type => 'integer', default => '0', not_null => 1 },
    ],

    relationships =>
    [
       ItemTemplate =>
        {
            type => 'one to one',
            class => 'Mangos::DB::Mangos::ItemTemplate',
            column_map => { item_template => 'entry' },
        },

    ],

    primary_key_columns => [ 'id' ],

    unique_key => [ 'itemguid' ],
);

1;

package Mangos::DB::Characters::Auctionhouse::Manager;

use strict;
use warnings;

use base 'Rose::DB::Object::Manager';

sub object_class { 'Mangos::DB::Characters::Auctionhouse' }

__PACKAGE__->make_manager_methods('auctionhouse');

1;
